import request from '@/utils/request';
import type { AxiosPromise } from '@/utils/request';
import type { DeliveryBeforeVO, DeliveryBeforeForm, DeliveryBeforeQuery } from '@/pagesA/api/workflow/deliveryBefore/types';

/**
 * 查询设备发货前验收报告列表
 * @param query
 * @returns {*}
 */

export const listDeliveryBefore = (query?: DeliveryBeforeQuery): AxiosPromise<DeliveryBeforeVO[]> => {
  return request({
    url: '/workflow/deliveryBefore/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询设备发货前验收报告详细
 * @param id
 */
export const getDeliveryBefore = (id: string | number): AxiosPromise<DeliveryBeforeVO> => {
  return request({
    url: '/workflow/deliveryBefore/' + id,
    method: 'get'
  });
};

/**
 * 新增设备发货前验收报告
 * @param data
 */
export const addDeliveryBefore = (data: DeliveryBeforeForm) => {
  return request({
    url: '/workflow/deliveryBefore',
    method: 'post',
    data: data
  });
};

/**
 * 修改设备发货前验收报告
 * @param data
 */
export const updateDeliveryBefore = (data: DeliveryBeforeForm) => {
  return request({
    url: '/workflow/deliveryBefore',
    method: 'put',
    data: data
  });
};

/**
 * 删除设备发货前验收报告
 * @param id
 */
export const delDeliveryBefore = (id: string | number | Array<string | number>) => {
  return request({
    url: '/workflow/deliveryBefore/' + id,
    method: 'delete'
  });
};
